package day12.convertedstream;

import java.io.*;

/**
 * @author Xiao
 * @date 2021/8/2
 */
public class ObjectOperateStreamDemo02 {
    /**
     *对象反序列化流的基本使用
     *       1.创建对象反序列化流：ObjectInputStream()
     *       2.调用readObject()方法。读取对象数据
     *       3.将读取的对象向下转型
     *       4.输出对象中的内容
     *       5.释放资源
     */
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream
                ("videoPractice\\src\\day12\\otherstream\\convertedstream\\oosdemo1.txt"));
//        Object o = ois.readObject();
        Student o = (Student) ois.readObject();
        //Student{name='aliang', age=24}
        System.out.println(o);
        ois.close();
    }
}
